﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>成绩查询</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <!-- Le styles -->
    <link href="./css/bootstrap.min.css" rel="stylesheet">
    <style type="text/css">
        body
        {
            padding-top: 60px;
            padding-bottom: 40px;
        }
        .sidebar-nav
        {
            padding: 9px 0;
        }
        
        @media (max-width: 980px)
        {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right
            {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }
    </style>
    <link href="./css/bootstrap-responsive.min.css" rel="stylesheet">
    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="//cdnjs.bootcss.com/ajax/libs/html5shiv/3.6.2/html5shiv.js"></script>
    <![endif]-->
    <!-- Fav and touch icons -->
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="../assets/ico/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="../assets/ico/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="../assets/ico/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="../assets/ico/apple-touch-icon-57-precomposed.png">
    <link rel="shortcut icon" href="../assets/ico/favicon.png">
</head>
<body>
    <div class="navbar navbar-inverse navbar-fixed-top">
        <div class="navbar-inner">
            <div class="container-fluid">
                <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                    <span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar">
                    </span>
                </button>
                <a class="brand" href="#">学生成绩管理系统</a>
                <div class="nav-collapse collapse">
                    <p class="navbar-text pull-right">
                        Logged in as <a href="#" class="navbar-link">Username</a>
                    </p>
                    <ul class="nav" id="mainMenu">
                    </ul>
                </div>
                <!--/.nav-collapse -->
            </div>
        </div>
    </div>
    <div class="container-fluid">
        <div id="main" class="row-fluid">
            <div id="main-left" class="span3 bs-docs-sidebar">
                <div class="well sidebar-nav bs-docs-sidenav">
                    <ul class="nav nav-list">
                        <li class="nav-header" id="sideTitle">成绩查询</li>
                        <li class="active"><a href="#selfSearch">查询个人成绩</a></li>
                        <li><a href="#singleSearch">查询单个学生成绩</a></li>
                        <li><a href="#classSearch">查询课程班级成绩</a></li>
                    </ul>
                </div>
                <!--/.well -->
            </div>
            <!--/span-->
            <div id="main-right" class="span9">
                <section id="selfSearch">
                <div id="selfSearch-unit" class="hero-unit">
                  <div id="Div1" class="">
                        <legend class="">查询个人成绩</legend>
                    </div>
                    <form id="form-singleSearch" class="form-inline">
                    <!-- Select Basic -->
                    <label class="control-label">
                        选择学期</label>
                    <select id="select-term" class="input-medium">
                    </select>
                    <!-- Select Basic -->
                    <label class="control-label">
                        选择课程</label>
                    <select id="select-course" class="input-medium">
                        <option></option>
                    </select>
                    <!-- Select Basic -->
                    <label class="control-label">
                        选择考试</label>
                    <select id="select-exzam" class="input-medium">
                        <option></option>
                    </select>
                    <!-- Button -->
                    <button id="searchbycond" class="btn btn-success">
                        根据单次考试成绩</button>
                    <button id="searchbycourse" class="btn btn-success">
                        查询课程成绩</button>
                    <!-- Button -->
                    <button id="searchterm" class="btn btn-success">
                        查询本学期成绩</button>
                    <!-- Button -->
                    <button id="searchhistory" class="btn btn-success">
                        查询历史成绩</button>

                    </form>
                     <table id="searchTable_selfSearch" class="table table-hover">
                        
                        
                    </table>
                </div>
                </section>
                <section id="singleSearch"><div id="singleSearch-unit" class="hero-unit">
                 <div id="Div2" class="">
                        <legend class="">查询单个学生成绩</legend>
                    </div>
                    <form class="form-inline">
                    <label class="control-label" for="inputStdNum">
                        学号：</label>
                    <input type="text" id="inputStdNum" class="input-large" placeholder="请输入学号" />
                       <button id="b_sSearch" class="btn btn-success">
                        查询所有成绩</button>
                    </form>
                    <table id="searchTable" class="table table-hover">
                        
                        
                    </table>
                </div></section>
                <section id="classSearch"><div id="classSearch-unit" class="hero-unit">
                   <div id="Div3" class="">
                        <legend class="">查询课程班级成绩</legend>
                    </div>
                    <form class="form-inline">
                    <label class="control-label" for="selectItem">
                        选择学期：</label>
                    <select id="select-term2" class="input-medium">
                    </select>
                   
                  
                    <label class="control-label" for="inputStdNum">
                        选择课程：</label>
                    <select id="select-course2" class="input-medium">
                    </select>
                    <button id="button_getScoreByCourse" type="submit" class="btn btn-success">
                        查询成绩</button>
                    </form>
                    <table id="Table_searchByClass" class="table table-hover">
                        
                        
                    </table>
                </div></section>
            </div>
            <!--/span-->
        </div>
        <!--/row-->
        <hr>
    </div>
    <!--/.fluid-container-->
    <!-- Le javascript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="./js/jquery.js"></script>
    <script src="./js/bootstrap.min.js"></script>
    <script src="js/mainMenu.js" type="text/javascript"></script>
    <script src="js/messenger.js" type="text/javascript"></script>
    <link href="css/messenger.css" rel="stylesheet" type="text/css" />
    <link href="css/messenger-theme-future.css" rel="stylesheet" type="text/css" />
    <script>
        //准备成绩合并，为用到
        function getUnionTable(tableid, jsondata, columsid, columsname) {
            tableNullCreate(tableid, columsname);
            var table = $("#" + tableid);
            columsid = eval(columsid);
            columsname = eval(columsname);
            var content = "";
            content += "<tbody>";
            var preCourseid = "";
            $(jsondata.Table).each(function (i, item) {
                console.log("i:" + i);

                if (item['courseid'] != preCourseid) {
                    content += "<tr>";

                    $(columsid).each(function (i2, item2) {
                        content += "<td>" + item[item2] + "</td>";
                    });
                    content += "</tr>";
                }


            });
            content += "</tbody>";
            table.append(content);

        }
    </script>
    <script>
        //根据条件查询，自己成绩
        //从后台获取选择条件
        var stdid = "1007433028";
        $('#select-term').change(function () {
            getConditByParams(
            { 'action': 'getCourseByTermStd',
                'term': $('#select-term').val(),
                'stdid': stdid
            },
            {
                selectid: "select-course",
                idcolum: "actualcourseid",
                name: "coursename"
            },
              function () { $('#select-course').change() }
              );
        });
        $('#select-course').change(function () {
            getConditByParams(
            { 'action': 'getExzamByCourseid',
                'courseid': $('#select-course').val(), 'stdid': stdid
            },
            { selectid: "select-exzam", idcolum: "exzamid", name: "name" },
            function () { }
            );
        });
        //根据条件查询
        $('#searchbycond').click(function () {
            var courseid = $("#select-course").val();
            var exzamid = $("#select-exzam").val();
            var params = {
                'action': 'getScoreByCondit',
                'exzamid': exzamid,
                "stdid": stdid,
                "courseid": courseid
            };
            $.post("handler/ScoreHandler.ashx", params,
            function (data, status) {
                var colums = ['stdid', 'name', 'score'];
                getFullTableRows("searchTable_selfSearch", data, colums);
                $.globalMessenger().post("操作成功");
            },
            "json");
        });
        //根据课程查询
        $("#searchbycourse").click(function () {
            var courseid = $("#select-course").val();
            var params = {
                'action': 'getScoreByCourseStd',
                'stdid': stdid,
                'courseid': courseid
            };
            $.post("handler/ScoreHandler.ashx", params,
            function (data, status) {
                var colums = ['stdid', 'name', 'score'];
                getFullTableRows("searchTable_selfSearch", data, colums);
                $.globalMessenger().post("操作成功");
            },
            "json");
        });
        //根据学期查询
        $("#searchterm").click(function () {
            var term = getCurrentYearTerm();
            var params = {
                'action': 'getScoreByTerm',
                'term': term,
                'stdid': stdid
            };
            $.post("handler/ScoreHandler.ashx", params,
            function (data, status) {
                var colums = ['stdid', 'name', 'score'];
                getFullTableRows("searchTable_selfSearch", data, colums);
                $.globalMessenger().post("操作成功");
            },
            "json");
        });
        //根据历史查询
        $("#searchhistory").click(function () {
            var params = {
                'action': 'getScoreByHistory',
                'stdid': stdid
            };
            $.post("handler/ScoreHandler.ashx", params,
            function (data, status) {
                var colums = ['stdid', 'name', 'score'];
                getFullTableRows("searchTable_selfSearch", data, colums);
                $.globalMessenger().post("操作成功");
            },
            "json");
        });
   
    </script>
    <script>
        //单个学生查询
        $("#b_sSearch").click(function () {
            var params = {
                'action': 'single_singleSearch',
                'stdid': $('#inputStdNum').val()
            };
            $.post("handler/ScoreHandler.ashx", params, function (data, status) {
                var colums = ['stdid', 'name', 'score'];
                getFullTableRows("searchTable", data, colums)
                $.globalMessenger().post("查询成功");
            }, 'json');
        });
    </script>
    <script>
        //根据课程显示成绩
        var techid = "1";
        getFourYearTerm("select-term");
        getFourYearTerm("select-term2");
        $("#button_getScoreByCourse").click(function () {
            var courseid = $("#select-course2").val();
            var params = {
                'action': 'getScoreByCourse',
                'courseid': courseid
            };
            $.post("./handler/ScoreHandler.ashx", params, function (data, status) {
                var colums = ['stdid', 'name', 'score'];
                getFullTableRows("Table_searchByClass", data, colums);
                $.globalMessenger().post("查询成功");
            }, 'json');
        });
        $('#select-term').change();
        $('#select-term2').change(function () {
            getConditByParams(
            { 'action': 'getCourseByTechTerm',
                'term': $('#select-term2').val(),
                'techid': techid
            },
            {
                selectid: "select-course2",
                idcolum: "actualcourseid",
                name: "coursename"
            },
              function () { $('#select-course2').change() }
              );
        });
        $('#select-term2').change();
    </script>
</body>
</html>
